//
//  XYJGLTableViewCell.m
//  徙游记-01
//
//  Created by hcios on 2017/7/10.
//  Copyright © 2017年 鹿林. All rights reserved.
//

#import "XYJGLTableViewCell.h"

@implementation XYJGLTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    
}

+(instancetype)cellWithTableView:(UITableView *)tableView{
    
    static NSString *identifier = @"cellID";
    
    XYJGLTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    
    if (cell == nil) {
        cell = [[XYJGLTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.separatorInset = UIEdgeInsetsMake(0, 10, 0, 10);
    cell.layoutMargins = UIEdgeInsetsMake(0, 10, 0, 10);
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self setupSubViews];
    }
    return self;
}


-(void)setupSubViews{
    //contextLab
    self.contextLab = [[UILabel alloc] init];
    [self.contextLab setFont:[UIFont fontWithName:FONT_NAME_LTH size:13]];
    [self.contextLab setTextColor:[UIColor blackColor]];
    [self addSubview:self.contextLab];
    
    //titleLab
    self.titleLab = [[UILabel alloc] init];
    self.titleLab.numberOfLines = 0;
    [self.titleLab setFont:[UIFont fontWithName:FONT_NAME_LTH size:15]];
    [self.titleLab setTextColor:[UIColor blueColor]];
    [self addSubview:self.titleLab];
}

//重写set方法
-(void)setFrameModel:(XYJGLFrameModel *)frameModel{
    
    _frameModel = frameModel;
    
    XYJGLModel * model = frameModel.model;
    
    
    self.titleLab.text = model.title;
    self.titleLab.frame = frameModel.titleFrame;
    
    
    self.contextLab.text = model.gl_description;
    self.contextLab.numberOfLines = 0;
    self.contextLab.frame = frameModel.contextFrame;
    
}

@end
